/*
 * Copyright 2002-2007 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.beans.factory.support;

import org.springframework.beans.factory.config.BeanDefinition;

/**
 * Strategy interface for generating bean names for bean definitions.
 * 用于为 BeanDefinition 生成 bean 名称的策略接口。
 * 本接口定义了一种策略：当 BeanDefinition 被注册到 Spring IoC 容器中但没有显式指定名称时，
 * 框架会通过实现类生成一个默认的 bean 名称。
 *
 * @author Juergen Hoeller
 * @since 2.0.3
 */
public interface BeanNameGenerator {

	/**
	 * Generate a bean name for the given bean definition.
	 * 为给定的 BeanDefinition 生成 bean 名称。
	 *
	 * @param definition the bean definition to generate a name for
	 *                   要生成名称的 BeanDefinition，包含 bean 的元数据信息（类、作用域等）。
	 * @param registry   the bean definition registry that the given definition
	 *                   is supposed to be registered with
	 *                   BeanDefinitionRegistry：bean 定义将要注册的容器。
	 *                   提供上下文环境，保证生成的名称在容器内唯一。
	 * @return the generated bean name
	 * 返回生成的 bean 名称，作为容器中注册的 key。
	 */
	String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry);

}
